#include"contact.pb.h"
#include<iostream>
#include<string>
int main()
{
    contacts::contact cn;
    cn.set_id(10086);
    cn.set_name("小明");

    //str是持久化数据,可用来网路传输
    std::string str=cn.SerializeAsString();

    
    contacts::contact stu;
    bool ret=stu.ParseFromString(str);
    if(!ret)
    {
        std::cout<<"失败"<<std::endl;
    }

    std::cout<<stu.id()<<std::endl;
    std::cout<<stu.name()<<std::endl;
    return 0;
}